﻿namespace GoodAdmin.System;

/// <summary>
/// 角色相关服务
/// </summary>
public interface ISysRoleService
{
    /// <summary>
    /// 新增角色
    /// </summary>
    /// <param name="input"></param>
    /// <returns></returns>
    Task AddRole(RoleAddInput input);
    /// <summary>
    /// 更新角色
    /// </summary>
    /// <param name="input"></param>
    /// <returns></returns>
    Task UpdateRole(RoleUpdateInput input);
    /// <summary>
    /// 删除角色
    /// </summary>
    /// <param name="input"></param>
    /// <returns></returns>
    Task DeleteRole(List<BaseIdInput> input);
    /// <summary>
    /// 分页获取角色列表
    /// </summary>
    /// <param name="input"></param>
    /// <returns></returns>
    Task<SqlSugarPagedList<SysRole>> GetRolePage(RolePageInput input);

    /// <summary>
    /// 分页获取角色列表
    /// </summary>
    /// <param name="input"></param>
    /// <returns></returns>
    Task<List<RoleSelectorOutput>> GetRoleSelector(RolePageInput input);
    /// <summary>
    /// 根据userid获取用户角色集合
    /// </summary>
    /// <param name="userId"></param>
    /// <returns></returns>
    Task<List<SysRole>> GetUserRoleList(long userId);
    /// <summary>
    /// 获取用户角色id集合
    /// </summary>
    /// <param name="userId"></param>
    /// <returns></returns>
    Task<List<long>> GetUserRoleIdList(long userId);
    /// <summary>
    /// 获取角色集合
    /// </summary>
    /// <returns></returns>
    Task<List<SysRole>> GetRoleList();

    /// <summary>
    /// 获取角色授权用户id
    /// </summary>
    /// <param name="roleId"></param>
    /// <returns></returns>
    Task<List<long>> GetRoleOwnUser(long roleId);

    /// <summary>
    /// 获取角色授权菜单id列表
    /// </summary>
    /// <param name="input"></param>
    /// <returns></returns>
    Task<List<long>> GetRoleOweMenu(BaseIdInput input);
    /// <summary>
    /// 为角色授权菜单
    /// </summary>
    /// <param name="input"></param>
    /// <returns></returns>
    Task GrantRoleMenus(RoleMenusInput input);

    /// <summary>
    /// 为角色授权用户
    /// </summary>
    /// <param name="input"></param>
    /// <returns></returns>
    Task GrantRoleUsers(RoleUsersInput input);

    /// <summary>
    /// 获取角色对应的接口资源
    /// </summary>
    /// <param name="input"></param>
    /// <returns></returns>
    Task<List<string>> GetResource(BaseIdInput input);

    /// <summary>
    /// 获取角色已分配资源
    /// </summary>
    /// <param name="input"></param>
    /// <returns></returns>
    Task<RoleResourceOutput> GetRoleOwnResource(BaseIdInput input);

    /// <summary>
    /// 为角色授权资源
    /// </summary>
    /// <param name="input"></param>
    /// <returns></returns>
    Task GrantRoleResource(RoleResourceInput input);

    /// <summary>
    /// 获取基础公共权限对应菜单路由列表
    /// </summary>
    /// <returns></returns>
    Task<List<SysMenu>> GetCommonRoleMenu();
}
